﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;

using BrightIdeasSoftware;

namespace FCNS.KeepMoney.Util
{
    class PrintStyle
    {
        public enum TrintStyles
        {
            简单=0,
            时尚
        }

        public static void ApplyStyle(ListViewPrinter listView, int index)
        {
            switch (index)
            { 
                case 0:
                    ApplyMinimalFormatting(listView);
                    break;
                case 1:
                    ApplyModernFormatting(listView);
                    break;
            }
        }

        static void ApplyMinimalFormatting(ListViewPrinter listView)
        {
            listView.CellFormat = null;
            listView.ListFont = new Font("Tahoma", 9);

            listView.HeaderFormat = BlockFormat.Header();
            listView.HeaderFormat.TextBrush = Brushes.Black;
            listView.HeaderFormat.BackgroundBrush = null;
            listView.HeaderFormat.SetBorderPen(Sides.Bottom, new Pen(Color.Black, 0.5f));

            listView.FooterFormat = BlockFormat.Footer();
            listView.GroupHeaderFormat = BlockFormat.GroupHeader();
            listView.GroupHeaderFormat.SetBorder(Sides.Bottom, 2, new LinearGradientBrush(new Rectangle(0, 0, 1, 1), Color.Gray, Color.White, LinearGradientMode.Horizontal));

            listView.ListHeaderFormat = BlockFormat.ListHeader();
            listView.ListHeaderFormat.BackgroundBrush = null;

            listView.WatermarkFont = null;
            listView.WatermarkColor = Color.Empty;
        }

        static void ApplyModernFormatting(ListViewPrinter listView)
        {
            listView.CellFormat = null;
            listView.ListFont = new Font("Ms Sans Serif", 9);
            listView.ListGridPen = new Pen(Color.DarkGray, 0.5f);

            listView.HeaderFormat = BlockFormat.Header(new Font("Verdana", 24, FontStyle.Bold));
            listView.HeaderFormat.BackgroundBrush = new LinearGradientBrush(new Rectangle(0, 0, 1, 1), Color.DarkBlue, Color.White, LinearGradientMode.Horizontal);

            listView.FooterFormat = BlockFormat.Footer();
            listView.FooterFormat.BackgroundBrush = new LinearGradientBrush(new Rectangle(0, 0, 1, 1), Color.White, Color.DarkBlue, LinearGradientMode.Horizontal);

            listView.GroupHeaderFormat = BlockFormat.GroupHeader();
            listView.ListHeaderFormat = BlockFormat.ListHeader(new Font("Verdana", 12));

            listView.WatermarkFont = null;
            listView.WatermarkColor = Color.Empty;
        }
    }
}
